Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: let vite create final paths #400

Closed
wants to merge 3 commits into from

Conversation

pzerelles
Copy link
Contributor

  • Quick Checklist
  • I have read the contributing guidelines
  • [n/a] I have written new tests, as applicable (for bug fixes / features)
  • [n/a] Docs have been added / updated (for bug fixes / features)
  • I have added a changeset, if applicable
  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
    This PR fixes the paths of images in the Vite build result. Before the filename was added to viteConfig.base which leads to relative urls that don't work anymore in nested paths.

  • What is the new behavior (if this is a feature change)?
    Instead of inserting the final path in imagetools, the existing placeholder logic from Vite is used and Vite will do the replacement.

  • Does this PR introduce a breaking change? (What changes might users need to make in their application due to this
    PR?)

  • Other information:

@changeset-bot
Copy link

changeset-bot bot commented Sep 22, 2022

🦋 Changeset detected

Latest commit: 4722969

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
vite-imagetools Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link

codecov bot commented Sep 28, 2022

Codecov Report

Merging #400 (4722969) into main (be09695) will decrease coverage by 0.08%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #400      +/-   ##
==========================================
- Coverage   96.53%   96.44%   -0.09%     
==========================================
  Files          31       31              
  Lines        1097     1070      -27     
  Branches      227      221       -6     
==========================================
- Hits         1059     1032      -27     
  Misses         38       38              
Flag Coverage Δ
imagetools-core 98.51% <ø> (ø)
rollup-plugin-imagetools 99.20% <ø> (ø)
vite-imagetools 81.88% <100.00%> (-2.97%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/vite/src/index.ts 81.88% <100.00%> (-2.97%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@benmccann
Copy link
Collaborator

Could you please add a test?

@frankmayer
Copy link

Fixed my issue with sveltekit adapter-static build

@benmccann
Copy link
Collaborator

@pzerelles we'd love to get this PR in as it seems to address issues people are having, but I'm afraid we don't understand it well enough yet. If you could take a look at adding a description and some tests that would be great

@pzerelles
Copy link
Contributor Author

I planned to add tests but didn't have the time yet. It is not so easy because the bigger part of the change affects only the "srcset" parameter and there was no test for this parameter before, as far as I could see.

Will try to come up with something when I have time. Or we can talk on Discord about the change.

@JonasKruckenberg
Copy link
Owner

Okay so two small things:

  1. Having tests would be good, I know it's difficult. If you need any help let me know.
  2. With the usage of magic-string gone, we should also remove it from the dependencies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants